const electron = require('electron')
const ipcMain = electron.ipcMain
module.exports = function (mainWindow) {
  ipcMain.on('sync-close', (event, arg) => {
    mainWindow.close()
  })
  ipcMain.on('sync-minimize', (event, arg) => {
    if (!mainWindow.isMinimized()) {
      mainWindow.minimize()
      console.log('可以最小化')
    } else {
      console.log('不可最小化，因为已经最小化了')
    }
  })
  ipcMain.on('sync-maximize', (event, arg) => {
    if (mainWindow.isMaximized()) {
      mainWindow.unmaximize()
    } else {
      mainWindow.maximize()
    }
    event.sender.send('send-isMax', mainWindow.isMaximized())
  })
}
